Commit 5d7eda1d authored by Abhijeet Kandalkar's avatar Abhijeet Kandalkar Committed by Commit Bot

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: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720813}
parent 33f7986e
...@@ -706,7 +706,7 @@ void StyleAdjuster::AdjustComputedStyle(StyleResolverState& state, ...@@ -706,7 +706,7 @@ void StyleAdjuster::AdjustComputedStyle(StyleResolverState& state,
} }
// SVG text layout code expects us to be a block-level style element. // SVG text layout code expects us to be a block-level style element.
if ((IsSVGForeignObjectElement(*element) || if ((IsA<SVGForeignObjectElement>(*element) ||
IsA<SVGTextElement>(*element)) && IsA<SVGTextElement>(*element)) &&
style.IsDisplayInlineType()) style.IsDisplayInlineType())
style.SetDisplay(EDisplay::kBlock); style.SetDisplay(EDisplay::kBlock);
......
...@@ -3008,7 +3008,7 @@ scoped_refptr<ComputedStyle> Element::StyleForLayoutObject( ...@@ -3008,7 +3008,7 @@ scoped_refptr<ComputedStyle> Element::StyleForLayoutObject(
style->UpdateIsStackingContext(this == GetDocument().documentElement(), style->UpdateIsStackingContext(this == GetDocument().documentElement(),
IsInTopLayer(), IsInTopLayer(),
IsSVGForeignObjectElement(*this)); IsA<SVGForeignObjectElement>(*this));
return style; return style;
} }
......
...@@ -323,7 +323,7 @@ static bool IsSVGText(Text* text) { ...@@ -323,7 +323,7 @@ static bool IsSVGText(Text* text) {
Node* parent_or_shadow_host_node = text->ParentOrShadowHostNode(); Node* parent_or_shadow_host_node = text->ParentOrShadowHostNode();
DCHECK(parent_or_shadow_host_node); DCHECK(parent_or_shadow_host_node);
return parent_or_shadow_host_node->IsSVGElement() && 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, LayoutText* Text::CreateTextLayoutObject(const ComputedStyle& style,
......
...@@ -90,7 +90,7 @@ void LayoutSVGForeignObject::ComputeLogicalHeight( ...@@ -90,7 +90,7 @@ void LayoutSVGForeignObject::ComputeLogicalHeight(
void LayoutSVGForeignObject::UpdateLayout() { void LayoutSVGForeignObject::UpdateLayout() {
DCHECK(NeedsLayout()); DCHECK(NeedsLayout());
SVGForeignObjectElement* foreign = ToSVGForeignObjectElement(GetElement()); auto* foreign = To<SVGForeignObjectElement>(GetElement());
bool update_cached_boundaries_in_parents = false; bool update_cached_boundaries_in_parents = false;
if (needs_transform_update_) { if (needs_transform_update_) {
......
...@@ -155,7 +155,7 @@ bool SVGImage::CurrentFrameHasSingleSecurityOrigin() const { ...@@ -155,7 +155,7 @@ bool SVGImage::CurrentFrameHasSingleSecurityOrigin() const {
// Don't allow foreignObject elements or images that are not known to be // Don't allow foreignObject elements or images that are not known to be
// single-origin since these can leak cross-origin information. // single-origin since these can leak cross-origin information.
for (Node* node = root_element; node; node = FlatTreeTraversal::Next(*node)) { for (Node* node = root_element; node; node = FlatTreeTraversal::Next(*node)) {
if (IsSVGForeignObjectElement(*node)) if (IsA<SVGForeignObjectElement>(*node))
return false; return false;
if (auto* image = DynamicTo<SVGImageElement>(*node)) { if (auto* image = DynamicTo<SVGImageElement>(*node)) {
if (!image->CurrentFrameHasSingleSecurityOrigin()) if (!image->CurrentFrameHasSingleSecurityOrigin())
......
...@@ -52,7 +52,7 @@ bool TargetCanHaveMotionTransform(const SVGElement& target) { ...@@ -52,7 +52,7 @@ bool TargetCanHaveMotionTransform(const SVGElement& target) {
IsA<SVGPolylineElement>(target) || IsA<SVGPolygonElement>(target) || IsA<SVGPolylineElement>(target) || IsA<SVGPolygonElement>(target) ||
IsA<SVGTextElement>(target) || IsA<SVGClipPathElement>(target) || IsA<SVGTextElement>(target) || IsA<SVGClipPathElement>(target) ||
IsA<SVGMaskElement>(target) || IsSVGAElement(target) || IsA<SVGMaskElement>(target) || IsSVGAElement(target) ||
IsSVGForeignObjectElement(target); IsA<SVGForeignObjectElement>(target);
} }
} }
......
...@@ -122,7 +122,7 @@ bool SVGElement::IsOutermostSVGSVGElement() const { ...@@ -122,7 +122,7 @@ bool SVGElement::IsOutermostSVGSVGElement() const {
// We act like an outermost SVG element, if we're a direct child of a // We act like an outermost SVG element, if we're a direct child of a
// <foreignObject> element. // <foreignObject> element.
if (IsSVGForeignObjectElement(*parentNode())) if (IsA<SVGForeignObjectElement>(*parentNode()))
return true; return true;
// If we're living in a shadow tree, we're a <svg> element that got created as // If we're living in a shadow tree, we're a <svg> element that got created as
......
...@@ -54,7 +54,8 @@ void SVGGraphicsElement::Trace(blink::Visitor* visitor) { ...@@ -54,7 +54,8 @@ void SVGGraphicsElement::Trace(blink::Visitor* visitor) {
static bool IsViewportElement(const Element& element) { static bool IsViewportElement(const Element& element) {
return (IsA<SVGSVGElement>(element) || IsA<SVGSymbolElement>(element) || return (IsA<SVGSVGElement>(element) || IsA<SVGSymbolElement>(element) ||
IsSVGForeignObjectElement(element) || IsA<SVGImageElement>(element)); IsA<SVGForeignObjectElement>(element) ||
IsA<SVGImageElement>(element));
} }
AffineTransform SVGGraphicsElement::ComputeCTM( AffineTransform SVGGraphicsElement::ComputeCTM(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment