Bug 1556351 - Part 1: Add HTMLElement sizeof assertion; r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D124784
This commit is contained in:
Edgar Chen 2021-10-04 20:51:25 +00:00
Родитель 53fd454cdc
Коммит aa0cb1e018
4 изменённых файлов: 32 добавлений и 15 удалений

Просмотреть файл

@ -80,6 +80,7 @@
#include "mozilla/dom/FromParser.h"
#include "mozilla/dom/Grid.h"
#include "mozilla/dom/HTMLDivElement.h"
#include "mozilla/dom/HTMLElement.h"
#include "mozilla/dom/HTMLParagraphElement.h"
#include "mozilla/dom/HTMLPreElement.h"
#include "mozilla/dom/HTMLSpanElement.h"
@ -223,6 +224,7 @@ namespace mozilla::dom {
// bucket sizes.
ASSERT_NODE_SIZE(Element, 128, 80);
ASSERT_NODE_SIZE(HTMLDivElement, 128, 80);
ASSERT_NODE_SIZE(HTMLElement, 128, 80);
ASSERT_NODE_SIZE(HTMLParagraphElement, 128, 80);
ASSERT_NODE_SIZE(HTMLPreElement, 128, 80);
ASSERT_NODE_SIZE(HTMLSpanElement, 128, 80);

Просмотреть файл

@ -4,24 +4,12 @@
* 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/. */
#include "nsGenericHTMLElement.h"
#include "mozilla/dom/HTMLElement.h"
#include "mozilla/dom/HTMLElementBinding.h"
#include "nsContentUtils.h"
namespace mozilla::dom {
class HTMLElement final : public nsGenericHTMLElement {
public:
explicit HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
virtual ~HTMLElement();
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
protected:
JSObject* WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
};
HTMLElement::HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: nsGenericHTMLElement(std::move(aNodeInfo)) {
if (NodeInfo()->Equals(nsGkAtoms::bdi)) {
@ -29,8 +17,6 @@ HTMLElement::HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
}
}
HTMLElement::~HTMLElement() = default;
NS_IMPL_ELEMENT_CLONE(HTMLElement)
JSObject* HTMLElement::WrapNode(JSContext* aCx,

28
dom/html/HTMLElement.h Normal file
Просмотреть файл

@ -0,0 +1,28 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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_HTMLElement_h
#define mozilla_dom_HTMLElement_h
#include "nsGenericHTMLElement.h"
namespace mozilla::dom {
class HTMLElement final : public nsGenericHTMLElement {
public:
explicit HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
virtual ~HTMLElement() = default;
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
protected:
JSObject* WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
};
} // namespace mozilla::dom
#endif // mozilla_dom_HTMLElement_h

Просмотреть файл

@ -63,6 +63,7 @@ EXPORTS.mozilla.dom += [
"HTMLDialogElement.h",
"HTMLDivElement.h",
"HTMLDNSPrefetch.h",
"HTMLElement.h",
"HTMLEmbedElement.h",
"HTMLFieldSetElement.h",
"HTMLFontElement.h",