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: */
|
2013-02-08 20:34:48 +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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_HTMLAreaElement_h
|
|
|
|
#define mozilla_dom_HTMLAreaElement_h
|
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-07-10 13:56:47 +04:00
|
|
|
#include "mozilla/dom/Link.h"
|
2013-02-08 20:34:48 +04:00
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
#include "nsGkAtoms.h"
|
|
|
|
#include "nsIURL.h"
|
|
|
|
|
2013-03-22 04:05:19 +04:00
|
|
|
class nsIDocument;
|
|
|
|
|
2013-02-08 20:34:48 +04:00
|
|
|
namespace mozilla {
|
2014-03-18 08:48:20 +04:00
|
|
|
class EventChainPostVisitor;
|
2014-03-18 08:48:19 +04:00
|
|
|
class EventChainPreVisitor;
|
2013-02-08 20:34:48 +04:00
|
|
|
namespace dom {
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class HTMLAreaElement final : public nsGenericHTMLElement,
|
2015-03-27 21:52:19 +03:00
|
|
|
public Link
|
2013-02-08 20:34:48 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit HTMLAreaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2013-02-08 20:34:48 +04:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2013-12-12 23:30:27 +04:00
|
|
|
// CC
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLAreaElement,
|
|
|
|
nsGenericHTMLElement)
|
|
|
|
|
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 09:37:33 +03:00
|
|
|
NS_DECL_ADDSIZEOFEXCLUDINGTHIS
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2017-09-22 03:52:28 +03:00
|
|
|
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLAreaElement, area)
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2017-09-22 03:52:28 +03:00
|
|
|
virtual int32_t TabIndexDefault() override;
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2016-10-21 05:11:07 +03:00
|
|
|
virtual nsresult GetEventTargetParent(
|
|
|
|
EventChainPreVisitor& aVisitor) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
|
|
|
virtual bool IsLink(nsIURI** aURI) const override;
|
|
|
|
virtual void GetLinkTarget(nsAString& aTarget) override;
|
|
|
|
virtual already_AddRefed<nsIURI> GetHrefURI() const override;
|
2013-02-08 20:34:48 +04:00
|
|
|
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aCompileEventHandlers) override;
|
2013-02-08 20:34:48 +04:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNullParent = true) override;
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2017-04-20 22:57:48 +03:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
|
|
|
|
bool aPreallocateChildren) const override;
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual EventStates IntrinsicState() const override;
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2013-02-08 20:34:48 +04:00
|
|
|
// WebIDL
|
2017-09-22 03:52:28 +03:00
|
|
|
void GetAlt(DOMString& aValue)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::alt, aValue);
|
|
|
|
}
|
2013-02-08 20:34:48 +04:00
|
|
|
void SetAlt(const nsAString& aAlt, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::alt, aAlt, aError);
|
|
|
|
}
|
|
|
|
|
2017-09-22 03:52:28 +03:00
|
|
|
void GetCoords(DOMString& aValue)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::coords, aValue);
|
|
|
|
}
|
2013-02-08 20:34:48 +04:00
|
|
|
void SetCoords(const nsAString& aCoords, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::coords, aCoords, aError);
|
|
|
|
}
|
|
|
|
|
2017-09-22 03:52:28 +03:00
|
|
|
// argument type nsAString for HTMLImageMapAccessible
|
|
|
|
void GetShape(nsAString& aValue)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::shape, aValue);
|
|
|
|
}
|
2013-02-08 20:34:48 +04:00
|
|
|
void SetShape(const nsAString& aShape, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::shape, aShape, aError);
|
|
|
|
}
|
|
|
|
|
2017-09-22 03:52:28 +03:00
|
|
|
// argument type nsAString for nsContextMenuInfo
|
|
|
|
void GetHref(nsAString& aValue)
|
|
|
|
{
|
|
|
|
GetURIAttr(nsGkAtoms::href, nullptr, aValue);
|
|
|
|
}
|
2013-02-08 21:56:59 +04:00
|
|
|
void SetHref(const nsAString& aHref, ErrorResult& aError)
|
|
|
|
{
|
2017-09-22 03:52:28 +03:00
|
|
|
SetHTMLAttr(nsGkAtoms::href, aHref, aError);
|
2013-02-08 21:56:59 +04:00
|
|
|
}
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2017-09-22 03:52:28 +03:00
|
|
|
void GetTarget(DOMString& aValue);
|
2013-02-08 20:34:48 +04:00
|
|
|
void SetTarget(const nsAString& aTarget, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::target, aTarget, aError);
|
|
|
|
}
|
|
|
|
|
2017-09-22 03:52:28 +03:00
|
|
|
void GetDownload(DOMString& aValue)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::download, aValue);
|
|
|
|
}
|
2013-02-08 20:34:48 +04:00
|
|
|
void SetDownload(const nsAString& aDownload, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::download, aDownload, aError);
|
|
|
|
}
|
|
|
|
|
2017-09-22 03:52:28 +03:00
|
|
|
void GetPing(DOMString& aValue)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::ping, aValue);
|
|
|
|
}
|
|
|
|
|
2013-02-08 20:34:48 +04:00
|
|
|
void SetPing(const nsAString& aPing, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::ping, aPing, aError);
|
|
|
|
}
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2015-02-13 04:27:39 +03:00
|
|
|
void GetRel(DOMString& aValue)
|
2014-03-11 16:04:26 +04:00
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::rel, aValue);
|
|
|
|
}
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2014-03-11 16:04:26 +04:00
|
|
|
void SetRel(const nsAString& aRel, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::rel, aRel, aError);
|
2017-07-06 15:00:35 +03:00
|
|
|
}
|
2014-03-11 16:04:26 +04:00
|
|
|
nsDOMTokenList* RelList();
|
2014-07-12 03:30:27 +04:00
|
|
|
|
2015-12-01 03:13:03 +03:00
|
|
|
void SetReferrerPolicy(const nsAString& aValue, mozilla::ErrorResult& rv)
|
2015-06-06 01:25:24 +03:00
|
|
|
{
|
2015-12-01 03:13:03 +03:00
|
|
|
SetHTMLAttr(nsGkAtoms::referrerpolicy, aValue, rv);
|
2015-06-06 01:25:24 +03:00
|
|
|
}
|
2015-12-01 03:13:03 +03:00
|
|
|
void GetReferrerPolicy(nsAString& aReferrer)
|
2015-06-06 01:25:24 +03:00
|
|
|
{
|
2016-04-18 13:35:47 +03:00
|
|
|
GetEnumAttr(nsGkAtoms::referrerpolicy, EmptyCString().get(), aReferrer);
|
2015-06-06 01:25:24 +03:00
|
|
|
}
|
|
|
|
|
2013-12-12 23:30:27 +04:00
|
|
|
// The Link::GetOrigin is OK for us
|
2013-09-04 21:05:10 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetProtocol is OK for us
|
|
|
|
// Link::Link::SetProtocol is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2013-12-12 23:30:27 +04:00
|
|
|
// The Link::GetUsername is OK for us
|
|
|
|
// The Link::SetUsername is OK for us
|
2013-09-04 21:05:10 +04:00
|
|
|
|
2013-12-12 23:30:27 +04:00
|
|
|
// The Link::GetPassword is OK for us
|
|
|
|
// The Link::SetPassword is OK for us
|
2013-09-04 21:05:10 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetHost is OK for us
|
|
|
|
// Link::Link::SetHost is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetHostname is OK for us
|
|
|
|
// Link::Link::SetHostname is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetPort is OK for us
|
|
|
|
// Link::Link::SetPort is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetPathname is OK for us
|
|
|
|
// Link::Link::SetPathname is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetSearch is OK for us
|
|
|
|
// Link::Link::SetSearch is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2015-11-23 23:05:26 +03:00
|
|
|
// Link::Link::GetHash is OK for us
|
|
|
|
// Link::Link::SetHash is OK for us
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2013-12-12 23:30:27 +04:00
|
|
|
// The Link::GetSearchParams is OK for us
|
|
|
|
|
2013-02-08 20:34:48 +04:00
|
|
|
bool NoHref() const
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::nohref);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetNoHref(bool aValue, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::nohref, aValue, aError);
|
|
|
|
}
|
|
|
|
|
2017-09-22 03:52:28 +03:00
|
|
|
void ToString(nsAString& aSource);
|
2015-11-23 23:05:26 +03:00
|
|
|
void Stringify(nsAString& aResult)
|
2013-03-05 13:46:48 +04:00
|
|
|
{
|
2015-11-23 23:05:26 +03:00
|
|
|
GetHref(aResult);
|
2013-03-05 13:46:48 +04:00
|
|
|
}
|
|
|
|
|
2017-04-15 18:55:05 +03:00
|
|
|
virtual void NodeInfoChanged(nsIDocument* aOldDoc) final override
|
|
|
|
{
|
|
|
|
ClearHasPendingLinkUpdate();
|
|
|
|
nsGenericHTMLElement::NodeInfoChanged(aOldDoc);
|
|
|
|
}
|
|
|
|
|
2013-02-08 20:34:48 +04:00
|
|
|
protected:
|
2014-07-09 01:23:16 +04:00
|
|
|
virtual ~HTMLAreaElement();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-02-08 20:34:48 +04:00
|
|
|
|
2017-06-07 20:28:20 +03:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
|
|
|
const nsAttrValue* aValue,
|
|
|
|
const nsAttrValue* aOldValue,
|
|
|
|
bool aNotify) override;
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsDOMTokenList > mRelList;
|
2013-02-08 20:34:48 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_HTMLAreaElement_h */
|