Use new downcast helper for blink::SVGForeignObjectElement

This CL has two goals,
  1. Use To<SVGForeignObjectElement> as new downcast helper
  2. Use IsA<SVGForeignObjectElement>(element) in place of
     IsSVGForeignObjectElement(element)

Bug: 891908
Change-Id: I6ad9fe6116758ba05ea8e7339b71405fc1f9348b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1936585
Commit-Queue: Abhijeet | Igalia <abhijeet@igalia.com>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720813}
diff --git a/third_party/blink/renderer/core/css/resolver/style_adjuster.cc b/third_party/blink/renderer/core/css/resolver/style_adjuster.cc
index f35f771..d2faa2d 100644
--- a/third_party/blink/renderer/core/css/resolver/style_adjuster.cc
+++ b/third_party/blink/renderer/core/css/resolver/style_adjuster.cc
@@ -706,7 +706,7 @@
     }
 
     // SVG text layout code expects us to be a block-level style element.
-    if ((IsSVGForeignObjectElement(*element) ||
+    if ((IsA<SVGForeignObjectElement>(*element) ||
          IsA<SVGTextElement>(*element)) &&
         style.IsDisplayInlineType())
       style.SetDisplay(EDisplay::kBlock);
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc
index b929577..fde71e5 100644
--- a/third_party/blink/renderer/core/dom/element.cc
+++ b/third_party/blink/renderer/core/dom/element.cc
@@ -3008,7 +3008,7 @@
 
   style->UpdateIsStackingContext(this == GetDocument().documentElement(),
                                  IsInTopLayer(),
-                                 IsSVGForeignObjectElement(*this));
+                                 IsA<SVGForeignObjectElement>(*this));
 
   return style;
 }
diff --git a/third_party/blink/renderer/core/dom/text.cc b/third_party/blink/renderer/core/dom/text.cc
index d270af5..d572463 100644
--- a/third_party/blink/renderer/core/dom/text.cc
+++ b/third_party/blink/renderer/core/dom/text.cc
@@ -323,7 +323,7 @@
   Node* parent_or_shadow_host_node = text->ParentOrShadowHostNode();
   DCHECK(parent_or_shadow_host_node);
   return parent_or_shadow_host_node->IsSVGElement() &&
-         !IsSVGForeignObjectElement(*parent_or_shadow_host_node);
+         !IsA<SVGForeignObjectElement>(*parent_or_shadow_host_node);
 }
 
 LayoutText* Text::CreateTextLayoutObject(const ComputedStyle& style,
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_foreign_object.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_foreign_object.cc
index f494825..6c2f0e0 100644
--- a/third_party/blink/renderer/core/layout/svg/layout_svg_foreign_object.cc
+++ b/third_party/blink/renderer/core/layout/svg/layout_svg_foreign_object.cc
@@ -90,7 +90,7 @@
 void LayoutSVGForeignObject::UpdateLayout() {
   DCHECK(NeedsLayout());
 
-  SVGForeignObjectElement* foreign = ToSVGForeignObjectElement(GetElement());
+  auto* foreign = To<SVGForeignObjectElement>(GetElement());
 
   bool update_cached_boundaries_in_parents = false;
   if (needs_transform_update_) {
diff --git a/third_party/blink/renderer/core/svg/graphics/svg_image.cc b/third_party/blink/renderer/core/svg/graphics/svg_image.cc
index 89c04fc..8fd0092 100644
--- a/third_party/blink/renderer/core/svg/graphics/svg_image.cc
+++ b/third_party/blink/renderer/core/svg/graphics/svg_image.cc
@@ -155,7 +155,7 @@
   // Don't allow foreignObject elements or images that are not known to be
   // single-origin since these can leak cross-origin information.
   for (Node* node = root_element; node; node = FlatTreeTraversal::Next(*node)) {
-    if (IsSVGForeignObjectElement(*node))
+    if (IsA<SVGForeignObjectElement>(*node))
       return false;
     if (auto* image = DynamicTo<SVGImageElement>(*node)) {
       if (!image->CurrentFrameHasSingleSecurityOrigin())
diff --git a/third_party/blink/renderer/core/svg/svg_animate_motion_element.cc b/third_party/blink/renderer/core/svg/svg_animate_motion_element.cc
index 877bbdd..1ffb379 100644
--- a/third_party/blink/renderer/core/svg/svg_animate_motion_element.cc
+++ b/third_party/blink/renderer/core/svg/svg_animate_motion_element.cc
@@ -52,7 +52,7 @@
          IsA<SVGPolylineElement>(target) || IsA<SVGPolygonElement>(target) ||
          IsA<SVGTextElement>(target) || IsA<SVGClipPathElement>(target) ||
          IsA<SVGMaskElement>(target) || IsSVGAElement(target) ||
-         IsSVGForeignObjectElement(target);
+         IsA<SVGForeignObjectElement>(target);
 }
 }
 
diff --git a/third_party/blink/renderer/core/svg/svg_element.cc b/third_party/blink/renderer/core/svg/svg_element.cc
index 41e45b4..899109d 100644
--- a/third_party/blink/renderer/core/svg/svg_element.cc
+++ b/third_party/blink/renderer/core/svg/svg_element.cc
@@ -122,7 +122,7 @@
 
   // We act like an outermost SVG element, if we're a direct child of a
   // <foreignObject> element.
-  if (IsSVGForeignObjectElement(*parentNode()))
+  if (IsA<SVGForeignObjectElement>(*parentNode()))
     return true;
 
   // If we're living in a shadow tree, we're a <svg> element that got created as
diff --git a/third_party/blink/renderer/core/svg/svg_graphics_element.cc b/third_party/blink/renderer/core/svg/svg_graphics_element.cc
index f80eb6a..6727515 100644
--- a/third_party/blink/renderer/core/svg/svg_graphics_element.cc
+++ b/third_party/blink/renderer/core/svg/svg_graphics_element.cc
@@ -54,7 +54,8 @@
 
 static bool IsViewportElement(const Element& element) {
   return (IsA<SVGSVGElement>(element) || IsA<SVGSymbolElement>(element) ||
-          IsSVGForeignObjectElement(element) || IsA<SVGImageElement>(element));
+          IsA<SVGForeignObjectElement>(element) ||
+          IsA<SVGImageElement>(element));
 }
 
 AffineTransform SVGGraphicsElement::ComputeCTM(