Inline static Create() from core/html - 5

As advised in [1], this CL ports calls to Foo::Create() factory
functions to use MakeGarbageCollected<Foo> from classes in
//third_party/blink/renderer/core/html.

[1] https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/iJ1bawbxbWs/vEdfT5QtBgAJ

Bug: 939691
Change-Id: I653cc77c7bc180d64184a773e4c8fe446ba4bb4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1581620
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Cr-Commit-Position: refs/heads/master@{#653974}
diff --git a/third_party/blink/renderer/core/animation/scroll_timeline_util_test.cc b/third_party/blink/renderer/core/animation/scroll_timeline_util_test.cc
index 8f7c41e..f40ae17a 100644
--- a/third_party/blink/renderer/core/animation/scroll_timeline_util_test.cc
+++ b/third_party/blink/renderer/core/animation/scroll_timeline_util_test.cc
@@ -3,10 +3,12 @@
 // found in the LICENSE file.
 
 #include "third_party/blink/renderer/core/animation/scroll_timeline_util.h"
+
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/blink/renderer/core/animation/document_timeline.h"
 #include "third_party/blink/renderer/core/html/html_div_element.h"
 #include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 
 namespace blink {
 
@@ -90,7 +92,7 @@
 }
 
 TEST_F(ScrollTimelineUtilTest, ToCompositorScrollTimelineNullLayoutBox) {
-  Element* div = HTMLDivElement::Create(GetDocument());
+  auto* div = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   ASSERT_FALSE(div->GetLayoutBox());
 
   ScrollTimelineOptions* options = ScrollTimelineOptions::Create();
@@ -202,7 +204,7 @@
 }
 
 TEST_F(ScrollTimelineUtilTest, GetCompositorScrollElementIdNullLayoutObject) {
-  Element* div = HTMLDivElement::Create(GetDocument());
+  auto* div = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   ASSERT_FALSE(div->GetLayoutObject());
   EXPECT_EQ(GetCompositorScrollElementId(nullptr), base::nullopt);
 }
diff --git a/third_party/blink/renderer/core/css/style_engine_test.cc b/third_party/blink/renderer/core/css/style_engine_test.cc
index 463c65be..4c15a15 100644
--- a/third_party/blink/renderer/core/css/style_engine_test.cc
+++ b/third_party/blink/renderer/core/css/style_engine_test.cc
@@ -5,6 +5,7 @@
 #include "third_party/blink/renderer/core/css/style_engine.h"
 
 #include <memory>
+
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/blink/public/common/css/preferred_color_scheme.h"
 #include "third_party/blink/public/platform/web_float_rect.h"
@@ -1374,7 +1375,7 @@
   EXPECT_TRUE(t1->NeedsStyleInvalidation());
 
   Element* t2 = GetDocument().getElementById("t2");
-  t2->appendChild(HTMLSpanElement::Create(GetDocument()));
+  t2->appendChild(MakeGarbageCollected<HTMLSpanElement>(GetDocument()));
   EXPECT_TRUE(t2->NeedsStyleInvalidation());
 }
 
@@ -1396,7 +1397,7 @@
   EXPECT_FALSE(t1->NeedsStyleInvalidation());
 
   Element* t2 = GetDocument().getElementById("t2");
-  t2->appendChild(HTMLSpanElement::Create(GetDocument()));
+  t2->appendChild(MakeGarbageCollected<HTMLSpanElement>(GetDocument()));
   EXPECT_FALSE(t2->NeedsStyleInvalidation());
 }
 
diff --git a/third_party/blink/renderer/core/dom/node_test.cc b/third_party/blink/renderer/core/dom/node_test.cc
index 5968a872..9e99d5e 100644
--- a/third_party/blink/renderer/core/dom/node_test.cc
+++ b/third_party/blink/renderer/core/dom/node_test.cc
@@ -15,6 +15,7 @@
 #include "third_party/blink/renderer/core/dom/shadow_root_init.h"
 #include "third_party/blink/renderer/core/editing/testing/editing_test_base.h"
 #include "third_party/blink/renderer/core/html/html_div_element.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 
 namespace blink {
 
@@ -57,7 +58,7 @@
     first_shadow.AppendChild(test_node);
     ShadowRoot& second_shadow = test_node->CreateUserAgentShadowRoot();
 
-    HTMLDivElement* class_div = HTMLDivElement::Create(GetDocument());
+    auto* class_div = MakeGarbageCollected<HTMLDivElement>(GetDocument());
     class_div->setAttribute("class", "test");
     second_shadow.AppendChild(class_div);
     return class_div;
@@ -288,7 +289,7 @@
 }
 
 TEST_F(NodeTest, HasMediaControlAncestor_Fail) {
-  HTMLDivElement* node = HTMLDivElement::Create(GetDocument());
+  auto* node = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   EXPECT_FALSE(node->HasMediaControlAncestor());
   EXPECT_FALSE(InitializeUserAgentShadowTree(node)->HasMediaControlAncestor());
 }
diff --git a/third_party/blink/renderer/core/dom/range_test.cc b/third_party/blink/renderer/core/dom/range_test.cc
index fb43a038..8c7f52d 100644
--- a/third_party/blink/renderer/core/dom/range_test.cc
+++ b/third_party/blink/renderer/core/dom/range_test.cc
@@ -28,6 +28,7 @@
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
 #include "third_party/blink/renderer/platform/geometry/float_quad.h"
 #include "third_party/blink/renderer/platform/heap/handle.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
 #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
 
@@ -271,7 +272,7 @@
 // Regression test for crbug.com/698123
 TEST_F(RangeTest, ExpandNotCrash) {
   Range* range = Range::Create(GetDocument());
-  Node* div = HTMLDivElement::Create(GetDocument());
+  auto* div = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   range->setStart(div, 0, ASSERT_NO_EXCEPTION);
   range->expand("", ASSERT_NO_EXCEPTION);
 }
diff --git a/third_party/blink/renderer/core/editing/commands/apply_style_command.cc b/third_party/blink/renderer/core/editing/commands/apply_style_command.cc
index 86d5e25..7a4c5575 100644
--- a/third_party/blink/renderer/core/editing/commands/apply_style_command.cc
+++ b/third_party/blink/renderer/core/editing/commands/apply_style_command.cc
@@ -483,7 +483,7 @@
       // Last styled node was not parent node of this text node, but we wish to
       // style this text node. To make this possible, add a style span to
       // surround this text node.
-      HTMLSpanElement* span = HTMLSpanElement::Create(GetDocument());
+      auto* span = MakeGarbageCollected<HTMLSpanElement>(GetDocument());
       SurroundNodeRangeWithElement(node, node, span, editing_state);
       if (editing_state->IsAborted())
         return;
@@ -1868,7 +1868,7 @@
   // It's okay to obtain the style at the startNode because we've removed all
   // relevant styles from the current run.
   if (!start_node->IsElementNode()) {
-    dummy_element = HTMLSpanElement::Create(GetDocument());
+    dummy_element = MakeGarbageCollected<HTMLSpanElement>(GetDocument());
     InsertNodeAt(dummy_element, Position::BeforeNode(*start_node),
                  editing_state);
     if (editing_state->IsAborted())
@@ -1959,7 +1959,8 @@
                          AtomicString(style_change.CssStyle()));
       }
     } else {
-      HTMLSpanElement* style_element = HTMLSpanElement::Create(GetDocument());
+      auto* style_element =
+          MakeGarbageCollected<HTMLSpanElement>(GetDocument());
       style_element->setAttribute(kStyleAttr,
                                   AtomicString(style_change.CssStyle()));
       SurroundNodeRangeWithElement(start_node, end_node, style_element,
diff --git a/third_party/blink/renderer/core/editing/commands/editing_commands_utilities_test.cc b/third_party/blink/renderer/core/editing/commands/editing_commands_utilities_test.cc
index 249ea01..d3a3b9b0 100644
--- a/third_party/blink/renderer/core/editing/commands/editing_commands_utilities_test.cc
+++ b/third_party/blink/renderer/core/editing/commands/editing_commands_utilities_test.cc
@@ -67,7 +67,7 @@
 }
 
 TEST_F(EditingCommandsUtilitiesTest, TidyUpHTMLStructureFromDiv) {
-  Element* div = HTMLDivElement::Create(GetDocument());
+  auto* div = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   MakeDocumentEmpty();
   GetDocument().setDesignMode("on");
   GetDocument().AppendChild(div);
diff --git a/third_party/blink/renderer/core/editing/commands/replace_node_with_span_command.cc b/third_party/blink/renderer/core/editing/commands/replace_node_with_span_command.cc
index 71a1f23..27f7fa7 100644
--- a/third_party/blink/renderer/core/editing/commands/replace_node_with_span_command.cc
+++ b/third_party/blink/renderer/core/editing/commands/replace_node_with_span_command.cc
@@ -35,6 +35,7 @@
 #include "third_party/blink/renderer/core/html/html_span_element.h"
 #include "third_party/blink/renderer/core/html_names.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/wtf/assertions.h"
 
 namespace blink {
@@ -66,8 +67,10 @@
 void ReplaceNodeWithSpanCommand::DoApply(EditingState*) {
   if (!element_to_replace_->isConnected())
     return;
-  if (!span_element_)
-    span_element_ = HTMLSpanElement::Create(element_to_replace_->GetDocument());
+  if (!span_element_) {
+    span_element_ = MakeGarbageCollected<HTMLSpanElement>(
+        element_to_replace_->GetDocument());
+  }
   SwapInNodePreservingAttributesAndChildren(span_element_.Get(),
                                             *element_to_replace_);
 }
diff --git a/third_party/blink/renderer/core/editing/commands/wrap_contents_in_dummy_span_command.cc b/third_party/blink/renderer/core/editing/commands/wrap_contents_in_dummy_span_command.cc
index 5817135..ee81b0a 100644
--- a/third_party/blink/renderer/core/editing/commands/wrap_contents_in_dummy_span_command.cc
+++ b/third_party/blink/renderer/core/editing/commands/wrap_contents_in_dummy_span_command.cc
@@ -29,6 +29,7 @@
 #include "third_party/blink/renderer/core/editing/editing_utilities.h"
 #include "third_party/blink/renderer/core/html/html_span_element.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 
 namespace blink {
 
@@ -48,7 +49,7 @@
 }
 
 void WrapContentsInDummySpanCommand::DoApply(EditingState*) {
-  dummy_span_ = HTMLSpanElement::Create(GetDocument());
+  dummy_span_ = MakeGarbageCollected<HTMLSpanElement>(GetDocument());
 
   ExecuteApply();
 }
diff --git a/third_party/blink/renderer/core/editing/editing_utilities.cc b/third_party/blink/renderer/core/editing/editing_utilities.cc
index e66f1a2..f64beba 100644
--- a/third_party/blink/renderer/core/editing/editing_utilities.cc
+++ b/third_party/blink/renderer/core/editing/editing_utilities.cc
@@ -1256,7 +1256,7 @@
 HTMLElement* CreateDefaultParagraphElement(Document& document) {
   switch (document.GetFrame()->GetEditor().DefaultParagraphSeparator()) {
     case EditorParagraphSeparator::kIsDiv:
-      return HTMLDivElement::Create(document);
+      return MakeGarbageCollected<HTMLDivElement>(document);
     case EditorParagraphSeparator::kIsP:
       return MakeGarbageCollected<HTMLParagraphElement>(document);
   }
@@ -1294,7 +1294,7 @@
 static HTMLSpanElement* CreateTabSpanElement(Document& document,
                                              Text* tab_text_node) {
   // Make the span to hold the tab.
-  HTMLSpanElement* span_element = HTMLSpanElement::Create(document);
+  auto* span_element = MakeGarbageCollected<HTMLSpanElement>(document);
   span_element->setAttribute(kStyleAttr, "white-space:pre");
 
   // Add tab text to that span.
diff --git a/third_party/blink/renderer/core/editing/granularity_strategy_test.cc b/third_party/blink/renderer/core/editing/granularity_strategy_test.cc
index 2999cdcc3..17bff03 100644
--- a/third_party/blink/renderer/core/editing/granularity_strategy_test.cc
+++ b/third_party/blink/renderer/core/editing/granularity_strategy_test.cc
@@ -220,7 +220,7 @@
   Text* text1 = GetDocument().createTextNode(str1);
   Text* text2 = GetDocument().createTextNode(str2);
   Text* text3 = GetDocument().createTextNode(str3);
-  Element* span = HTMLSpanElement::Create(GetDocument());
+  auto* span = MakeGarbageCollected<HTMLSpanElement>(GetDocument());
   Element* div = GetDocument().getElementById("mytext");
   div->AppendChild(text1);
   div->AppendChild(span);
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc
index e41cf5d..1ab62c9e 100644
--- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc
+++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc
@@ -141,8 +141,6 @@
   GetDocument().IncrementNumberOfCanvases();
 }
 
-DEFINE_NODE_FACTORY(HTMLCanvasElement)
-
 intptr_t HTMLCanvasElement::global_gpu_memory_usage_ = 0;
 unsigned HTMLCanvasElement::global_accelerated_context_count_ = 0;
 
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.h b/third_party/blink/renderer/core/html/canvas/html_canvas_element.h
index cc82f762..3bfbd2e 100644
--- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.h
+++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.h
@@ -110,8 +110,6 @@
  public:
   using Node::GetExecutionContext;
 
-  DECLARE_NODE_FACTORY(HTMLCanvasElement);
-
   explicit HTMLCanvasElement(Document&);
   ~HTMLCanvasElement() override;
 
diff --git a/third_party/blink/renderer/core/html/forms/chooser_only_temporal_input_type_view.cc b/third_party/blink/renderer/core/html/forms/chooser_only_temporal_input_type_view.cc
index 9428ca2..16be715 100644
--- a/third_party/blink/renderer/core/html/forms/chooser_only_temporal_input_type_view.cc
+++ b/third_party/blink/renderer/core/html/forms/chooser_only_temporal_input_type_view.cc
@@ -34,6 +34,7 @@
 #include "third_party/blink/renderer/core/page/chrome_client.h"
 #include "third_party/blink/renderer/core/page/page.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 
 namespace blink {
 
@@ -81,8 +82,8 @@
   DEFINE_STATIC_LOCAL(AtomicString, value_container_pseudo,
                       ("-webkit-date-and-time-value"));
 
-  HTMLDivElement* value_container =
-      HTMLDivElement::Create(GetElement().GetDocument());
+  auto* value_container =
+      MakeGarbageCollected<HTMLDivElement>(GetElement().GetDocument());
   value_container->SetShadowPseudoId(value_container_pseudo);
   GetElement().UserAgentShadowRoot()->AppendChild(value_container);
   UpdateView();
diff --git a/third_party/blink/renderer/core/html/forms/color_input_type.cc b/third_party/blink/renderer/core/html/forms/color_input_type.cc
index 4d41f7d..c7615ac5 100644
--- a/third_party/blink/renderer/core/html/forms/color_input_type.cc
+++ b/third_party/blink/renderer/core/html/forms/color_input_type.cc
@@ -49,6 +49,7 @@
 #include "third_party/blink/renderer/core/page/chrome_client.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
 #include "third_party/blink/renderer/platform/graphics/color.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
 
 namespace blink {
@@ -126,10 +127,10 @@
   DCHECK(IsShadowHost(GetElement()));
 
   Document& document = GetElement().GetDocument();
-  HTMLDivElement* wrapper_element = HTMLDivElement::Create(document);
+  auto* wrapper_element = MakeGarbageCollected<HTMLDivElement>(document);
   wrapper_element->SetShadowPseudoId(
       AtomicString("-webkit-color-swatch-wrapper"));
-  HTMLDivElement* color_swatch = HTMLDivElement::Create(document);
+  auto* color_swatch = MakeGarbageCollected<HTMLDivElement>(document);
   color_swatch->SetShadowPseudoId(AtomicString("-webkit-color-swatch"));
   wrapper_element->AppendChild(color_swatch);
   GetElement().UserAgentShadowRoot()->AppendChild(wrapper_element);
diff --git a/third_party/blink/renderer/core/html/forms/date_time_edit_element.cc b/third_party/blink/renderer/core/html/forms/date_time_edit_element.cc
index b47b0d1..4584d5e 100644
--- a/third_party/blink/renderer/core/html/forms/date_time_edit_element.cc
+++ b/third_party/blink/renderer/core/html/forms/date_time_edit_element.cc
@@ -36,6 +36,7 @@
 #include "third_party/blink/renderer/core/style/computed_style.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
 #include "third_party/blink/renderer/platform/fonts/font_cache.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/text/date_time_format.h"
 #include "third_party/blink/renderer/platform/text/platform_locale.h"
 #include "third_party/blink/renderer/platform/wtf/date_math.h"
@@ -464,7 +465,8 @@
   DEFINE_STATIC_LOCAL(AtomicString, text_pseudo_id,
                       ("-webkit-datetime-edit-text"));
   DCHECK_GT(text.length(), 0u);
-  HTMLDivElement* element = HTMLDivElement::Create(EditElement().GetDocument());
+  auto* element =
+      MakeGarbageCollected<HTMLDivElement>(EditElement().GetDocument());
   element->SetShadowPseudoId(text_pseudo_id);
   if (parameters_.locale.IsRTL() && text.length()) {
     WTF::unicode::CharDirection dir = WTF::unicode::Direction(text[0]);
@@ -724,7 +726,7 @@
   DEFINE_STATIC_LOCAL(AtomicString, fields_wrapper_pseudo_id,
                       ("-webkit-datetime-edit-fields-wrapper"));
   if (!HasChildren()) {
-    HTMLDivElement* element = HTMLDivElement::Create(GetDocument());
+    auto* element = MakeGarbageCollected<HTMLDivElement>(GetDocument());
     element->SetShadowPseudoId(fields_wrapper_pseudo_id);
     AppendChild(element);
   }
diff --git a/third_party/blink/renderer/core/html/forms/html_button_element.cc b/third_party/blink/renderer/core/html/forms/html_button_element.cc
index 1cc4b35..88dc36fd 100644
--- a/third_party/blink/renderer/core/html/forms/html_button_element.cc
+++ b/third_party/blink/renderer/core/html/forms/html_button_element.cc
@@ -42,10 +42,6 @@
       type_(SUBMIT),
       is_activated_submit_(false) {}
 
-HTMLButtonElement* HTMLButtonElement::Create(Document& document) {
-  return MakeGarbageCollected<HTMLButtonElement>(document);
-}
-
 const AttrNameToTrustedType& HTMLButtonElement::GetCheckedAttributeTypes()
     const {
   DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map,
diff --git a/third_party/blink/renderer/core/html/forms/html_button_element.h b/third_party/blink/renderer/core/html/forms/html_button_element.h
index e4c99dc3..77b2eb56f 100644
--- a/third_party/blink/renderer/core/html/forms/html_button_element.h
+++ b/third_party/blink/renderer/core/html/forms/html_button_element.h
@@ -32,8 +32,6 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  static HTMLButtonElement* Create(Document&);
-
   explicit HTMLButtonElement(Document&);
 
   const AttrNameToTrustedType& GetCheckedAttributeTypes() const override;
diff --git a/third_party/blink/renderer/core/html/forms/html_field_set_element.cc b/third_party/blink/renderer/core/html/forms/html_field_set_element.cc
index eba435c..3f38e31 100644
--- a/third_party/blink/renderer/core/html/forms/html_field_set_element.cc
+++ b/third_party/blink/renderer/core/html/forms/html_field_set_element.cc
@@ -43,10 +43,6 @@
 HTMLFieldSetElement::HTMLFieldSetElement(Document& document)
     : HTMLFormControlElement(kFieldsetTag, document) {}
 
-HTMLFieldSetElement* HTMLFieldSetElement::Create(Document& document) {
-  return MakeGarbageCollected<HTMLFieldSetElement>(document);
-}
-
 bool HTMLFieldSetElement::MatchesValidityPseudoClasses() const {
   return true;
 }
diff --git a/third_party/blink/renderer/core/html/forms/html_field_set_element.h b/third_party/blink/renderer/core/html/forms/html_field_set_element.h
index e77374d..9ae16b1 100644
--- a/third_party/blink/renderer/core/html/forms/html_field_set_element.h
+++ b/third_party/blink/renderer/core/html/forms/html_field_set_element.h
@@ -35,8 +35,6 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  static HTMLFieldSetElement* Create(Document&);
-
   explicit HTMLFieldSetElement(Document&);
 
   HTMLLegendElement* Legend() const;
diff --git a/third_party/blink/renderer/core/html/forms/html_label_element.cc b/third_party/blink/renderer/core/html/forms/html_label_element.cc
index 5babd13..2494b6f1 100644
--- a/third_party/blink/renderer/core/html/forms/html_label_element.cc
+++ b/third_party/blink/renderer/core/html/forms/html_label_element.cc
@@ -47,10 +47,6 @@
 HTMLLabelElement::HTMLLabelElement(Document& document)
     : HTMLElement(kLabelTag, document), processing_click_(false) {}
 
-HTMLLabelElement* HTMLLabelElement::Create(Document& document) {
-  return MakeGarbageCollected<HTMLLabelElement>(document);
-}
-
 HTMLElement* HTMLLabelElement::control() const {
   // https://html.spec.whatwg.org/C/#labeled-control
   const AtomicString& control_id = getAttribute(kForAttr);
diff --git a/third_party/blink/renderer/core/html/forms/html_label_element.h b/third_party/blink/renderer/core/html/forms/html_label_element.h
index ce3c0c4..126f9268 100644
--- a/third_party/blink/renderer/core/html/forms/html_label_element.h
+++ b/third_party/blink/renderer/core/html/forms/html_label_element.h
@@ -33,8 +33,6 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  static HTMLLabelElement* Create(Document&);
-
   explicit HTMLLabelElement(Document&);
 
   HTMLElement* control() const;
diff --git a/third_party/blink/renderer/core/html/forms/html_legend_element.cc b/third_party/blink/renderer/core/html/forms/html_legend_element.cc
index 78199ce..ac63d56 100644
--- a/third_party/blink/renderer/core/html/forms/html_legend_element.cc
+++ b/third_party/blink/renderer/core/html/forms/html_legend_element.cc
@@ -35,8 +35,6 @@
 HTMLLegendElement::HTMLLegendElement(Document& document)
     : HTMLElement(kLegendTag, document) {}
 
-DEFINE_NODE_FACTORY(HTMLLegendElement)
-
 HTMLFormElement* HTMLLegendElement::form() const {
   // According to the specification, If the legend has a fieldset element as
   // its parent, then the form attribute must return the same value as the
diff --git a/third_party/blink/renderer/core/html/forms/html_legend_element.h b/third_party/blink/renderer/core/html/forms/html_legend_element.h
index 495da50..c13cd6f 100644
--- a/third_party/blink/renderer/core/html/forms/html_legend_element.h
+++ b/third_party/blink/renderer/core/html/forms/html_legend_element.h
@@ -32,8 +32,6 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  DECLARE_NODE_FACTORY(HTMLLegendElement);
-
   explicit HTMLLegendElement(Document&);
 
   HTMLFormElement* form() const;
diff --git a/third_party/blink/renderer/core/html/forms/html_opt_group_element.cc b/third_party/blink/renderer/core/html/forms/html_opt_group_element.cc
index 499874c..e95c656 100644
--- a/third_party/blink/renderer/core/html/forms/html_opt_group_element.cc
+++ b/third_party/blink/renderer/core/html/forms/html_opt_group_element.cc
@@ -32,6 +32,7 @@
 #include "third_party/blink/renderer/core/html/html_slot_element.h"
 #include "third_party/blink/renderer/core/html/shadow/shadow_element_names.h"
 #include "third_party/blink/renderer/core/html_names.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
 #include "third_party/blink/renderer/platform/wtf/text/character_names.h"
 
@@ -134,7 +135,7 @@
 void HTMLOptGroupElement::DidAddUserAgentShadowRoot(ShadowRoot& root) {
   DEFINE_STATIC_LOCAL(AtomicString, label_padding, ("0 2px 1px 2px"));
   DEFINE_STATIC_LOCAL(AtomicString, label_min_height, ("1.2em"));
-  HTMLDivElement* label = HTMLDivElement::Create(GetDocument());
+  auto* label = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   label->setAttribute(kRoleAttr, AtomicString("group"));
   label->setAttribute(kAriaLabelAttr, AtomicString());
   label->SetInlineStyleProperty(CSSPropertyID::kPadding, label_padding);
diff --git a/third_party/blink/renderer/core/html/forms/html_output_element.cc b/third_party/blink/renderer/core/html/forms/html_output_element.cc
index 900980c..1d6388d 100644
--- a/third_party/blink/renderer/core/html/forms/html_output_element.cc
+++ b/third_party/blink/renderer/core/html/forms/html_output_element.cc
@@ -44,10 +44,6 @@
 
 HTMLOutputElement::~HTMLOutputElement() = default;
 
-HTMLOutputElement* HTMLOutputElement::Create(Document& document) {
-  return MakeGarbageCollected<HTMLOutputElement>(document);
-}
-
 const AtomicString& HTMLOutputElement::FormControlType() const {
   DEFINE_STATIC_LOCAL(const AtomicString, output, ("output"));
   return output;
diff --git a/third_party/blink/renderer/core/html/forms/html_output_element.h b/third_party/blink/renderer/core/html/forms/html_output_element.h
index a3e0fd6..632a646 100644
--- a/third_party/blink/renderer/core/html/forms/html_output_element.h
+++ b/third_party/blink/renderer/core/html/forms/html_output_element.h
@@ -40,8 +40,6 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  static HTMLOutputElement* Create(Document&);
-
   explicit HTMLOutputElement(Document&);
   ~HTMLOutputElement() override;
 
diff --git a/third_party/blink/renderer/core/html/forms/html_text_area_element.cc b/third_party/blink/renderer/core/html/forms/html_text_area_element.cc
index 2c1150e..4b946ee 100644
--- a/third_party/blink/renderer/core/html/forms/html_text_area_element.cc
+++ b/third_party/blink/renderer/core/html/forms/html_text_area_element.cc
@@ -48,6 +48,7 @@
 #include "third_party/blink/renderer/core/page/chrome_client.h"
 #include "third_party/blink/renderer/core/page/page.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/text/platform_locale.h"
 #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
 #include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
@@ -596,7 +597,7 @@
     return;
   }
   if (!placeholder) {
-    HTMLDivElement* new_element = HTMLDivElement::Create(GetDocument());
+    auto* new_element = MakeGarbageCollected<HTMLDivElement>(GetDocument());
     placeholder = new_element;
     placeholder->SetShadowPseudoId(AtomicString("-webkit-input-placeholder"));
     placeholder->setAttribute(kIdAttr, shadow_element_names::Placeholder());
diff --git a/third_party/blink/renderer/core/html/forms/range_input_type.cc b/third_party/blink/renderer/core/html/forms/range_input_type.cc
index 5137c3e..916b61a 100644
--- a/third_party/blink/renderer/core/html/forms/range_input_type.cc
+++ b/third_party/blink/renderer/core/html/forms/range_input_type.cc
@@ -33,6 +33,7 @@
 
 #include <algorithm>
 #include <limits>
+
 #include "third_party/blink/renderer/core/accessibility/ax_object_cache.h"
 #include "third_party/blink/renderer/core/dom/events/scoped_event_queue.h"
 #include "third_party/blink/renderer/core/dom/node_computed_style.h"
@@ -53,6 +54,7 @@
 #include "third_party/blink/renderer/core/input_type_names.h"
 #include "third_party/blink/renderer/core/layout/layout_slider.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/wtf/math_extras.h"
 
 namespace blink {
@@ -244,11 +246,11 @@
   DCHECK(IsShadowHost(GetElement()));
 
   Document& document = GetElement().GetDocument();
-  HTMLDivElement* track = HTMLDivElement::Create(document);
+  auto* track = MakeGarbageCollected<HTMLDivElement>(document);
   track->SetShadowPseudoId(AtomicString("-webkit-slider-runnable-track"));
   track->setAttribute(kIdAttr, shadow_element_names::SliderTrack());
   track->AppendChild(SliderThumbElement::Create(document));
-  HTMLElement* container = SliderContainerElement::Create(document);
+  auto* container = MakeGarbageCollected<SliderContainerElement>(document);
   container->AppendChild(track);
   GetElement().UserAgentShadowRoot()->AppendChild(container);
 }
diff --git a/third_party/blink/renderer/core/html/forms/slider_thumb_element.cc b/third_party/blink/renderer/core/html/forms/slider_thumb_element.cc
index c5c79e3..051cdeb 100644
--- a/third_party/blink/renderer/core/html/forms/slider_thumb_element.cc
+++ b/third_party/blink/renderer/core/html/forms/slider_thumb_element.cc
@@ -346,7 +346,7 @@
 
 // --------------------------------
 
-inline SliderContainerElement::SliderContainerElement(Document& document)
+SliderContainerElement::SliderContainerElement(Document& document)
     : HTMLDivElement(document),
       has_touch_event_handler_(false),
       touch_started_(false),
@@ -355,8 +355,6 @@
   SetHasCustomStyleCallbacks();
 }
 
-DEFINE_NODE_FACTORY(SliderContainerElement)
-
 HTMLInputElement* SliderContainerElement::HostInput() const {
   return ToHTMLInputElement(OwnerShadowHost());
 }
diff --git a/third_party/blink/renderer/core/html/forms/slider_thumb_element.h b/third_party/blink/renderer/core/html/forms/slider_thumb_element.h
index 0a95cbc..0423972 100644
--- a/third_party/blink/renderer/core/html/forms/slider_thumb_element.h
+++ b/third_party/blink/renderer/core/html/forms/slider_thumb_element.h
@@ -91,7 +91,6 @@
 
   explicit SliderContainerElement(Document&);
 
-  DECLARE_NODE_FACTORY(SliderContainerElement);
   HTMLInputElement* HostInput() const;
   void DefaultEventHandler(Event&) override;
   void HandleTouchEvent(TouchEvent*);
diff --git a/third_party/blink/renderer/core/html/forms/text_field_input_type.cc b/third_party/blink/renderer/core/html/forms/text_field_input_type.cc
index 29a2d80..86007a9 100644
--- a/third_party/blink/renderer/core/html/forms/text_field_input_type.cc
+++ b/third_party/blink/renderer/core/html/forms/text_field_input_type.cc
@@ -51,6 +51,7 @@
 #include "third_party/blink/renderer/core/paint/paint_layer.h"
 #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
 
 namespace blink {
@@ -473,8 +474,8 @@
     return;
   }
   if (!placeholder) {
-    HTMLElement* new_element =
-        HTMLDivElement::Create(GetElement().GetDocument());
+    auto* new_element =
+        MakeGarbageCollected<HTMLDivElement>(GetElement().GetDocument());
     placeholder = new_element;
     placeholder->SetShadowPseudoId(AtomicString("-webkit-input-placeholder"));
     placeholder->SetInlineStyleProperty(CSSPropertyID::kDisplay,
diff --git a/third_party/blink/renderer/core/html/html_anchor_element.cc b/third_party/blink/renderer/core/html/html_anchor_element.cc
index 94733fe..3e0ef25 100644
--- a/third_party/blink/renderer/core/html/html_anchor_element.cc
+++ b/third_party/blink/renderer/core/html/html_anchor_element.cc
@@ -69,10 +69,6 @@
       cached_visited_link_hash_(0),
       rel_list_(MakeGarbageCollected<RelList>(this)) {}
 
-HTMLAnchorElement* HTMLAnchorElement::Create(Document& document) {
-  return MakeGarbageCollected<HTMLAnchorElement>(kATag, document);
-}
-
 HTMLAnchorElement::~HTMLAnchorElement() = default;
 
 bool HTMLAnchorElement::SupportsFocus() const {
diff --git a/third_party/blink/renderer/core/html/html_anchor_element.h b/third_party/blink/renderer/core/html/html_anchor_element.h
index e8346f5..25b4cc9d 100644
--- a/third_party/blink/renderer/core/html/html_anchor_element.h
+++ b/third_party/blink/renderer/core/html/html_anchor_element.h
@@ -65,8 +65,6 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  static HTMLAnchorElement* Create(Document&);
-
   HTMLAnchorElement(Document& document);
   HTMLAnchorElement(const QualifiedName&, Document&);
   ~HTMLAnchorElement() override;
diff --git a/third_party/blink/renderer/core/html/html_area_element.cc b/third_party/blink/renderer/core/html/html_area_element.cc
index 940cb3f..ed56df1 100644
--- a/third_party/blink/renderer/core/html/html_area_element.cc
+++ b/third_party/blink/renderer/core/html/html_area_element.cc
@@ -54,8 +54,6 @@
 // definition.
 HTMLAreaElement::~HTMLAreaElement() = default;
 
-DEFINE_NODE_FACTORY(HTMLAreaElement)
-
 void HTMLAreaElement::ParseAttribute(
     const AttributeModificationParams& params) {
   const AtomicString& value = params.new_value;
diff --git a/third_party/blink/renderer/core/html/html_area_element.h b/third_party/blink/renderer/core/html/html_area_element.h
index d9d29f0..6dece51 100644
--- a/third_party/blink/renderer/core/html/html_area_element.h
+++ b/third_party/blink/renderer/core/html/html_area_element.h
@@ -38,8 +38,6 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  DECLARE_NODE_FACTORY(HTMLAreaElement);
-
   explicit HTMLAreaElement(Document&);
 
   bool IsDefault() const { return shape_ == kDefault; }
diff --git a/third_party/blink/renderer/core/html/html_base_element.cc b/third_party/blink/renderer/core/html/html_base_element.cc
index f3010d9..699ed554 100644
--- a/third_party/blink/renderer/core/html/html_base_element.cc
+++ b/third_party/blink/renderer/core/html/html_base_element.cc
@@ -37,8 +37,6 @@
 HTMLBaseElement::HTMLBaseElement(Document& document)
     : HTMLElement(kBaseTag, document) {}
 
-DEFINE_NODE_FACTORY(HTMLBaseElement)
-
 const AttrNameToTrustedType& HTMLBaseElement::GetCheckedAttributeTypes() const {
   DEFINE_STATIC_LOCAL(AttrNameToTrustedType, attribute_map,
                       ({{"href", SpecificTrustedType::kTrustedURL}}));
diff --git a/third_party/blink/renderer/core/html/html_base_element.h b/third_party/blink/renderer/core/html/html_base_element.h
index 32037b3..c7a4207 100644
--- a/third_party/blink/renderer/core/html/html_base_element.h
+++ b/third_party/blink/renderer/core/html/html_base_element.h
@@ -34,8 +34,6 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  DECLARE_NODE_FACTORY(HTMLBaseElement);
-
   explicit HTMLBaseElement(Document&);
 
   // Returns attributes that should be checked against Trusted Types
diff --git a/third_party/blink/renderer/core/html/html_bdi_element.h b/third_party/blink/renderer/core/html/html_bdi_element.h
index 067e912..e10914a 100644
--- a/third_party/blink/renderer/core/html/html_bdi_element.h
+++ b/third_party/blink/renderer/core/html/html_bdi_element.h
@@ -27,14 +27,10 @@
 
 class HTMLBDIElement final : public HTMLElement {
  public:
-  DECLARE_NODE_FACTORY(HTMLBDIElement);
-
   inline explicit HTMLBDIElement(Document& document)
       : HTMLElement(html_names::kBdiTag, document) {}
 };
 
-DEFINE_NODE_FACTORY(HTMLBDIElement)
-
 }  // namespace blink
 
 #endif
diff --git a/third_party/blink/renderer/core/html/html_body_element.cc b/third_party/blink/renderer/core/html/html_body_element.cc
index 045c453..f47282d2 100644
--- a/third_party/blink/renderer/core/html/html_body_element.cc
+++ b/third_party/blink/renderer/core/html/html_body_element.cc
@@ -45,8 +45,6 @@
 HTMLBodyElement::HTMLBodyElement(Document& document)
     : HTMLElement(kBodyTag, document) {}
 
-DEFINE_NODE_FACTORY(HTMLBodyElement)
-
 HTMLBodyElement::~HTMLBodyElement() = default;
 
 bool HTMLBodyElement::IsPresentationAttribute(const QualifiedName& name) const {
diff --git a/third_party/blink/renderer/core/html/html_details_element.cc b/third_party/blink/renderer/core/html/html_details_element.cc
index ec9b8bb..a7d8fee 100644
--- a/third_party/blink/renderer/core/html/html_details_element.cc
+++ b/third_party/blink/renderer/core/html/html_details_element.cc
@@ -37,6 +37,7 @@
 #include "third_party/blink/renderer/core/layout/layout_block_flow.h"
 #include "third_party/blink/renderer/core/layout/layout_object_factory.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/text/platform_locale.h"
 
 namespace blink {
@@ -83,7 +84,7 @@
   summary_slot->AppendChild(default_summary);
   root.AppendChild(summary_slot);
 
-  HTMLDivElement* content = HTMLDivElement::Create(GetDocument());
+  auto* content = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   content->SetIdAttribute(shadow_element_names::DetailsContent());
   content->AppendChild(
       HTMLSlotElement::CreateUserAgentDefaultSlot(GetDocument()));
diff --git a/third_party/blink/renderer/core/html/html_div_element.cc b/third_party/blink/renderer/core/html/html_div_element.cc
index 1aa4220..03fecf84 100644
--- a/third_party/blink/renderer/core/html/html_div_element.cc
+++ b/third_party/blink/renderer/core/html/html_div_element.cc
@@ -33,8 +33,6 @@
 HTMLDivElement::HTMLDivElement(Document& document)
     : HTMLElement(kDivTag, document) {}
 
-DEFINE_NODE_FACTORY(HTMLDivElement)
-
 void HTMLDivElement::CollectStyleForPresentationAttribute(
     const QualifiedName& name,
     const AtomicString& value,
diff --git a/third_party/blink/renderer/core/html/html_div_element.h b/third_party/blink/renderer/core/html/html_div_element.h
index fe95f93..e67cf8a 100644
--- a/third_party/blink/renderer/core/html/html_div_element.h
+++ b/third_party/blink/renderer/core/html/html_div_element.h
@@ -32,8 +32,6 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  DECLARE_NODE_FACTORY(HTMLDivElement);
-
   explicit HTMLDivElement(Document&);
 
  private:
diff --git a/third_party/blink/renderer/core/html/html_image_fallback_helper.cc b/third_party/blink/renderer/core/html/html_image_fallback_helper.cc
index 749dd8e..935b7a9 100644
--- a/third_party/blink/renderer/core/html/html_image_fallback_helper.cc
+++ b/third_party/blink/renderer/core/html/html_image_fallback_helper.cc
@@ -16,6 +16,7 @@
 #include "third_party/blink/renderer/core/html_names.h"
 #include "third_party/blink/renderer/core/input_type_names.h"
 #include "third_party/blink/renderer/core/style/computed_style.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
 
 namespace blink {
@@ -50,7 +51,8 @@
 void HTMLImageFallbackHelper::CreateAltTextShadowTree(Element& element) {
   ShadowRoot& root = element.EnsureUserAgentShadowRoot();
 
-  HTMLSpanElement* container = HTMLSpanElement::Create(element.GetDocument());
+  auto* container =
+      MakeGarbageCollected<HTMLSpanElement>(element.GetDocument());
   root.AppendChild(container);
   container->setAttribute(kIdAttr, AtomicString("alttext-container"));
 
@@ -65,7 +67,7 @@
   broken_image->SetInlineStyleProperty(CSSPropertyID::kMargin, 0,
                                        CSSPrimitiveValue::UnitType::kPixels);
 
-  HTMLSpanElement* alt_text = HTMLSpanElement::Create(element.GetDocument());
+  auto* alt_text = MakeGarbageCollected<HTMLSpanElement>(element.GetDocument());
   container->AppendChild(alt_text);
   alt_text->setAttribute(kIdAttr, AtomicString("alttext"));
 
diff --git a/third_party/blink/renderer/core/html/html_marquee_element.cc b/third_party/blink/renderer/core/html/html_marquee_element.cc
index efef0f5..ede4e62 100644
--- a/third_party/blink/renderer/core/html/html_marquee_element.cc
+++ b/third_party/blink/renderer/core/html/html_marquee_element.cc
@@ -68,7 +68,7 @@
       ":host > div { will-change: transform; }");
   shadow_root.AppendChild(style);
 
-  Element* mover = HTMLDivElement::Create(GetDocument());
+  auto* mover = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   shadow_root.AppendChild(mover);
 
   mover->AppendChild(
diff --git a/third_party/blink/renderer/core/html/html_meter_element.cc b/third_party/blink/renderer/core/html/html_meter_element.cc
index 634e40cf..e3b2ebb 100644
--- a/third_party/blink/renderer/core/html/html_meter_element.cc
+++ b/third_party/blink/renderer/core/html/html_meter_element.cc
@@ -29,6 +29,7 @@
 #include "third_party/blink/renderer/core/html_names.h"
 #include "third_party/blink/renderer/core/style/computed_style.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 
 namespace blink {
 
@@ -171,20 +172,20 @@
 void HTMLMeterElement::DidAddUserAgentShadowRoot(ShadowRoot& root) {
   DCHECK(!value_);
 
-  HTMLDivElement* inner = HTMLDivElement::Create(GetDocument());
+  auto* inner = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   inner->SetShadowPseudoId(AtomicString("-webkit-meter-inner-element"));
   root.AppendChild(inner);
 
-  HTMLDivElement* bar = HTMLDivElement::Create(GetDocument());
+  auto* bar = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   bar->SetShadowPseudoId(AtomicString("-webkit-meter-bar"));
 
-  value_ = HTMLDivElement::Create(GetDocument());
+  value_ = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   UpdateValueAppearance(0);
   bar->AppendChild(value_);
 
   inner->AppendChild(bar);
 
-  HTMLDivElement* fallback = HTMLDivElement::Create(GetDocument());
+  auto* fallback = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   fallback->AppendChild(
       HTMLSlotElement::CreateUserAgentDefaultSlot(GetDocument()));
   fallback->SetShadowPseudoId(AtomicString("-internal-fallback"));
diff --git a/third_party/blink/renderer/core/html/html_progress_element.cc b/third_party/blink/renderer/core/html/html_progress_element.cc
index 8767c92..de79938 100644
--- a/third_party/blink/renderer/core/html/html_progress_element.cc
+++ b/third_party/blink/renderer/core/html/html_progress_element.cc
@@ -27,6 +27,7 @@
 #include "third_party/blink/renderer/core/html_names.h"
 #include "third_party/blink/renderer/core/layout/layout_progress.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 
 namespace blink {
 
@@ -128,13 +129,13 @@
 void HTMLProgressElement::DidAddUserAgentShadowRoot(ShadowRoot& root) {
   DCHECK(!value_);
 
-  ProgressShadowElement* inner = ProgressShadowElement::Create(GetDocument());
+  auto* inner = MakeGarbageCollected<ProgressShadowElement>(GetDocument());
   inner->SetShadowPseudoId(AtomicString("-webkit-progress-inner-element"));
   root.AppendChild(inner);
 
-  ProgressShadowElement* bar = ProgressShadowElement::Create(GetDocument());
+  auto* bar = MakeGarbageCollected<ProgressShadowElement>(GetDocument());
   bar->SetShadowPseudoId(AtomicString("-webkit-progress-bar"));
-  value_ = ProgressShadowElement::Create(GetDocument());
+  value_ = MakeGarbageCollected<ProgressShadowElement>(GetDocument());
   value_->SetShadowPseudoId(AtomicString("-webkit-progress-value"));
   SetValueWidthPercentage(HTMLProgressElement::kIndeterminatePosition * 100);
   bar->AppendChild(value_);
diff --git a/third_party/blink/renderer/core/html/html_span_element.cc b/third_party/blink/renderer/core/html/html_span_element.cc
index d7a59e3..bb37b49 100644
--- a/third_party/blink/renderer/core/html/html_span_element.cc
+++ b/third_party/blink/renderer/core/html/html_span_element.cc
@@ -34,6 +34,4 @@
 HTMLSpanElement::HTMLSpanElement(Document& document)
     : HTMLElement(kSpanTag, document) {}
 
-DEFINE_NODE_FACTORY(HTMLSpanElement)
-
 }  // namespace blink
diff --git a/third_party/blink/renderer/core/html/html_span_element.h b/third_party/blink/renderer/core/html/html_span_element.h
index 887b4dd..414df62 100644
--- a/third_party/blink/renderer/core/html/html_span_element.h
+++ b/third_party/blink/renderer/core/html/html_span_element.h
@@ -35,8 +35,6 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  DECLARE_NODE_FACTORY(HTMLSpanElement);
-
   explicit HTMLSpanElement(Document&);
 };
 
diff --git a/third_party/blink/renderer/core/html/html_view_source_document.cc b/third_party/blink/renderer/core/html/html_view_source_document.cc
index 12284bf..db85614 100644
--- a/third_party/blink/renderer/core/html/html_view_source_document.cc
+++ b/third_party/blink/renderer/core/html/html_view_source_document.cc
@@ -74,7 +74,7 @@
 
   // Create a line gutter div that can be used to make sure the gutter extends
   // down the height of the whole document.
-  HTMLDivElement* div = HTMLDivElement::Create(*this);
+  auto* div = MakeGarbageCollected<HTMLDivElement>(*this);
   div->setAttribute(kClassAttr, "line-gutter-backdrop");
   body->ParserAppendChild(div);
 
@@ -199,7 +199,7 @@
     return current_;
   }
 
-  HTMLSpanElement* span = HTMLSpanElement::Create(*this);
+  auto* span = MakeGarbageCollected<HTMLSpanElement>(*this);
   span->setAttribute(kClassAttr, class_name);
   current_->ParserAppendChild(span);
   return span;
diff --git a/third_party/blink/renderer/core/html/image_document.cc b/third_party/blink/renderer/core/html/image_document.cc
index 0593f097..a6ae070 100644
--- a/third_party/blink/renderer/core/html/image_document.cc
+++ b/third_party/blink/renderer/core/html/image_document.cc
@@ -239,7 +239,7 @@
 
     // See w3c example on how to center an element:
     // https://www.w3.org/Style/Examples/007/center.en.html
-    div_element_ = HTMLDivElement::Create(*this);
+    div_element_ = MakeGarbageCollected<HTMLDivElement>(*this);
     div_element_->setAttribute(kStyleAttr,
                                "display: flex;"
                                "flex-direction: column;"
diff --git a/third_party/blink/renderer/core/html/media/media_remoting_interstitial.cc b/third_party/blink/renderer/core/html/media/media_remoting_interstitial.cc
index 422d87b..a9f19891 100644
--- a/third_party/blink/renderer/core/html/media/media_remoting_interstitial.cc
+++ b/third_party/blink/renderer/core/html/media/media_remoting_interstitial.cc
@@ -9,6 +9,7 @@
 #include "third_party/blink/renderer/core/html/html_image_element.h"
 #include "third_party/blink/renderer/core/html/media/html_video_element.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/text/platform_locale.h"
 
 namespace {
@@ -37,17 +38,17 @@
   background_image_->SetSrc(videoElement.getAttribute(html_names::kPosterAttr));
   AppendChild(background_image_);
 
-  cast_icon_ = HTMLDivElement::Create(GetDocument());
+  cast_icon_ = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   cast_icon_->SetShadowPseudoId(
       AtomicString("-internal-media-remoting-cast-icon"));
   AppendChild(cast_icon_);
 
-  cast_text_message_ = HTMLDivElement::Create(GetDocument());
+  cast_text_message_ = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   cast_text_message_->SetShadowPseudoId(
       AtomicString("-internal-media-interstitial-message"));
   AppendChild(cast_text_message_);
 
-  toast_message_ = HTMLDivElement::Create(GetDocument());
+  toast_message_ = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   toast_message_->SetShadowPseudoId(
       AtomicString("-internal-media-remoting-toast-message"));
   AppendChild(toast_message_);
diff --git a/third_party/blink/renderer/core/html/media/picture_in_picture_interstitial.cc b/third_party/blink/renderer/core/html/media/picture_in_picture_interstitial.cc
index 26e70c15f..4fcc9b92 100644
--- a/third_party/blink/renderer/core/html/media/picture_in_picture_interstitial.cc
+++ b/third_party/blink/renderer/core/html/media/picture_in_picture_interstitial.cc
@@ -14,6 +14,7 @@
 #include "third_party/blink/renderer/core/resize_observer/resize_observer.h"
 #include "third_party/blink/renderer/core/resize_observer/resize_observer_entry.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/text/platform_locale.h"
 
 namespace {
@@ -73,7 +74,7 @@
   background_image_->SetSrc(videoElement.getAttribute(html_names::kPosterAttr));
   ParserAppendChild(background_image_);
 
-  message_element_ = HTMLDivElement::Create(GetDocument());
+  message_element_ = MakeGarbageCollected<HTMLDivElement>(GetDocument());
   message_element_->SetShadowPseudoId(
       AtomicString("-internal-picture-in-picture-interstitial-message"));
   message_element_->setInnerText(
diff --git a/third_party/blink/renderer/core/html/track/vtt/vtt_cue.cc b/third_party/blink/renderer/core/html/track/vtt/vtt_cue.cc
index 9660051..64fb987 100644
--- a/third_party/blink/renderer/core/html/track/vtt/vtt_cue.cc
+++ b/third_party/blink/renderer/core/html/track/vtt/vtt_cue.cc
@@ -48,6 +48,7 @@
 #include "third_party/blink/renderer/core/layout/layout_vtt_cue.h"
 #include "third_party/blink/renderer/platform/bindings/exception_messages.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
 #include "third_party/blink/renderer/platform/text/bidi_resolver.h"
 #include "third_party/blink/renderer/platform/text/text_run_iterator.h"
@@ -245,7 +246,7 @@
       writing_direction_(kHorizontal),
       cue_alignment_(kCenter),
       vtt_node_tree_(nullptr),
-      cue_background_box_(HTMLDivElement::Create(document)),
+      cue_background_box_(MakeGarbageCollected<HTMLDivElement>(document)),
       snap_to_lines_(true),
       display_tree_should_change_(true) {
   UseCounter::Count(document, WebFeature::kVTTCue);
diff --git a/third_party/blink/renderer/core/html/track/vtt/vtt_region.cc b/third_party/blink/renderer/core/html/track/vtt/vtt_region.cc
index 7e1b8e4..28fe0d2 100644
--- a/third_party/blink/renderer/core/html/track/vtt/vtt_region.cc
+++ b/third_party/blink/renderer/core/html/track/vtt/vtt_region.cc
@@ -39,6 +39,7 @@
 #include "third_party/blink/renderer/core/html/track/vtt/vtt_scanner.h"
 #include "third_party/blink/renderer/platform/bindings/exception_messages.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/scheduler/public/thread.h"
 #include "third_party/blink/renderer/platform/wtf/math_extras.h"
 
@@ -272,7 +273,7 @@
 
 HTMLDivElement* VTTRegion::GetDisplayTree(Document& document) {
   if (!region_display_tree_) {
-    region_display_tree_ = HTMLDivElement::Create(document);
+    region_display_tree_ = MakeGarbageCollected<HTMLDivElement>(document);
     PrepareRegionDisplayTree();
   }
 
@@ -380,7 +381,8 @@
 
   // The cue container is used to wrap the cues and it is the object which is
   // gradually scrolled out as multiple cues are appended to the region.
-  cue_container_ = HTMLDivElement::Create(region_display_tree_->GetDocument());
+  cue_container_ =
+      MakeGarbageCollected<HTMLDivElement>(region_display_tree_->GetDocument());
   cue_container_->SetInlineStyleProperty(CSSPropertyID::kTop, 0.0,
                                          CSSPrimitiveValue::UnitType::kPixels);
 
diff --git a/third_party/blink/renderer/modules/media_controls/elements/media_control_elements_helper.cc b/third_party/blink/renderer/modules/media_controls/elements/media_control_elements_helper.cc
index b1d1553..aff6232 100644
--- a/third_party/blink/renderer/modules/media_controls/elements/media_control_elements_helper.cc
+++ b/third_party/blink/renderer/modules/media_controls/elements/media_control_elements_helper.cc
@@ -13,6 +13,7 @@
 #include "third_party/blink/renderer/modules/media_controls/elements/media_control_div_element.h"
 #include "third_party/blink/renderer/modules/media_controls/elements/media_control_input_element.h"
 #include "third_party/blink/renderer/modules/media_controls/media_controls_impl.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 
 namespace blink {
 
@@ -74,7 +75,7 @@
 HTMLDivElement* MediaControlElementsHelper::CreateDiv(const AtomicString& id,
                                                       ContainerNode* parent) {
   DCHECK(parent);
-  HTMLDivElement* element = HTMLDivElement::Create(parent->GetDocument());
+  auto* element = MakeGarbageCollected<HTMLDivElement>(parent->GetDocument());
   element->SetShadowPseudoId(id);
   parent->ParserAppendChild(element);
   return element;
@@ -104,7 +105,7 @@
     const AtomicString& id,
     ContainerNode* parent) {
   DCHECK(parent);
-  HTMLDivElement* element = HTMLDivElement::Create(parent->GetDocument());
+  auto* element = MakeGarbageCollected<HTMLDivElement>(parent->GetDocument());
   element->setAttribute("id", id);
   parent->ParserAppendChild(element);
   return element;
diff --git a/third_party/blink/renderer/modules/media_controls/elements/media_control_input_element.cc b/third_party/blink/renderer/modules/media_controls/elements/media_control_input_element.cc
index 1201aea..65ee21c 100644
--- a/third_party/blink/renderer/modules/media_controls/elements/media_control_input_element.cc
+++ b/third_party/blink/renderer/modules/media_controls/elements/media_control_input_element.cc
@@ -58,7 +58,7 @@
   // We don't want the button visible within the overflow menu.
   button->SetInlineStyleProperty(CSSPropertyID::kDisplay, CSSValueID::kNone);
 
-  overflow_menu_text_ = HTMLSpanElement::Create(GetDocument());
+  overflow_menu_text_ = MakeGarbageCollected<HTMLSpanElement>(GetDocument());
   overflow_menu_text_->setInnerText(button->GetOverflowMenuString(),
                                     ASSERT_NO_EXCEPTION);
 
@@ -76,7 +76,8 @@
   button->setTabIndex(-1);
 
   if (MediaControlsImpl::IsModern()) {
-    overflow_menu_container_ = HTMLDivElement::Create(GetDocument());
+    overflow_menu_container_ =
+        MakeGarbageCollected<HTMLDivElement>(GetDocument());
     overflow_menu_container_->ParserAppendChild(overflow_menu_text_);
     overflow_menu_container_->setAttribute(html_names::kAriaHiddenAttr, "true");
     aria_label_ = button->getAttribute(html_names::kAriaLabelAttr) + " " +
@@ -116,7 +117,8 @@
     overflow_menu_subtitle_->setInnerText(text, ASSERT_NO_EXCEPTION);
   } else {
     // Otherwise, create a new element.
-    overflow_menu_subtitle_ = HTMLSpanElement::Create(GetDocument());
+    overflow_menu_subtitle_ =
+        MakeGarbageCollected<HTMLSpanElement>(GetDocument());
     overflow_menu_subtitle_->setInnerText(text, ASSERT_NO_EXCEPTION);
     overflow_menu_subtitle_->setAttribute("class", kOverflowSubtitleCSSClass);
 
diff --git a/third_party/blink/renderer/modules/media_controls/elements/media_control_panel_element_test.cc b/third_party/blink/renderer/modules/media_controls/elements/media_control_panel_element_test.cc
index a6faf08..526b7ec 100644
--- a/third_party/blink/renderer/modules/media_controls/elements/media_control_panel_element_test.cc
+++ b/third_party/blink/renderer/modules/media_controls/elements/media_control_panel_element_test.cc
@@ -12,6 +12,7 @@
 #include "third_party/blink/renderer/core/input_type_names.h"
 #include "third_party/blink/renderer/core/testing/page_test_base.h"
 #include "third_party/blink/renderer/modules/media_controls/media_controls_impl.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 
 namespace blink {
 
@@ -67,7 +68,8 @@
 };
 
 TEST_F(MediaControlPanelElementTest, StateTransitions) {
-  Element* child_div = HTMLDivElement::Create(GetPanel().GetDocument());
+  auto* child_div =
+      MakeGarbageCollected<HTMLDivElement>(GetPanel().GetDocument());
   GetPanel().ParserAppendChild(child_div);
 
   // Make sure we are displayed (we are already opaque).
diff --git a/third_party/blink/renderer/modules/media_controls/elements/media_control_text_track_list_element.cc b/third_party/blink/renderer/modules/media_controls/elements/media_control_text_track_list_element.cc
index 48c75ccc..953e0ce 100644
--- a/third_party/blink/renderer/modules/media_controls/elements/media_control_text_track_list_element.cc
+++ b/third_party/blink/renderer/modules/media_controls/elements/media_control_text_track_list_element.cc
@@ -153,7 +153,7 @@
   // contents twice.
   String track_label =
       GetMediaControls().GetTextTrackManager().GetTextTrackLabel(track);
-  HTMLSpanElement* track_label_span = HTMLSpanElement::Create(GetDocument());
+  auto* track_label_span = MakeGarbageCollected<HTMLSpanElement>(GetDocument());
   track_label_span->setInnerText(track_label, ASSERT_NO_EXCEPTION);
   track_label_span->setAttribute(html_names::kAriaHiddenAttr, "true");
   track_item->setAttribute(html_names::kAriaLabelAttr,
@@ -165,7 +165,8 @@
   // Add a track kind marker icon if there are multiple tracks with the same
   // label or if the track has no label.
   if (track && (track->label().IsEmpty() || HasDuplicateLabel(track))) {
-    HTMLSpanElement* track_kind_marker = HTMLSpanElement::Create(GetDocument());
+    auto* track_kind_marker =
+        MakeGarbageCollected<HTMLSpanElement>(GetDocument());
     if (track->kind() == track->CaptionsKeyword()) {
       track_kind_marker->SetShadowPseudoId(AtomicString(
           "-internal-media-controls-text-track-list-kind-captions"));