Commit 2eaa955d authored by Abhijeet Kandalkar's avatar Abhijeet Kandalkar Committed by Commit Bot

Use new downcast helper for blink::SVGTextElement

This CL has goal to use IsA<SVGTextElement>(element) in place of
IsSVGTextElement(element)

Bug: 891908
Change-Id: Ie5f192bb485ee66fcc7ba9b0d13082cbcb6b572c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1936625
Commit-Queue: Abhijeet | Igalia <abhijeet@igalia.com>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720341}
parent 35b01d93
...@@ -706,12 +706,13 @@ void StyleAdjuster::AdjustComputedStyle(StyleResolverState& state, ...@@ -706,12 +706,13 @@ 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) || IsSVGTextElement(*element)) && if ((IsSVGForeignObjectElement(*element) ||
IsA<SVGTextElement>(*element)) &&
style.IsDisplayInlineType()) style.IsDisplayInlineType())
style.SetDisplay(EDisplay::kBlock); style.SetDisplay(EDisplay::kBlock);
// Columns don't apply to svg text elements. // Columns don't apply to svg text elements.
if (IsSVGTextElement(*element)) if (IsA<SVGTextElement>(*element))
style.ClearMultiCol(); style.ClearMultiCol();
} else if (element && element->IsMathMLElement()) { } else if (element && element->IsMathMLElement()) {
if (style.Display() == EDisplay::kContents) { if (style.Display() == EDisplay::kContents) {
......
...@@ -639,7 +639,7 @@ static PositionTemplate<Strategy> MostBackwardCaretPosition( ...@@ -639,7 +639,7 @@ static PositionTemplate<Strategy> MostBackwardCaretPosition(
} }
// There is no caret position in non-text svg elements. // There is no caret position in non-text svg elements.
if (current_node->IsSVGElement() && !IsSVGTextElement(current_node)) if (current_node->IsSVGElement() && !IsA<SVGTextElement>(current_node))
continue; continue;
// If we've moved to a position that is visually distinct, return the last // If we've moved to a position that is visually distinct, return the last
...@@ -786,7 +786,7 @@ PositionTemplate<Strategy> MostForwardCaretPosition( ...@@ -786,7 +786,7 @@ PositionTemplate<Strategy> MostForwardCaretPosition(
break; break;
// There is no caret position in non-text svg elements. // There is no caret position in non-text svg elements.
if (current_node->IsSVGElement() && !IsSVGTextElement(current_node)) if (current_node->IsSVGElement() && !IsA<SVGTextElement>(current_node))
continue; continue;
// Do not move to a visually distinct position. // Do not move to a visually distinct position.
......
...@@ -50,7 +50,7 @@ bool TargetCanHaveMotionTransform(const SVGElement& target) { ...@@ -50,7 +50,7 @@ bool TargetCanHaveMotionTransform(const SVGElement& target) {
IsA<SVGRectElement>(target) || IsSVGCircleElement(target) || IsA<SVGRectElement>(target) || IsSVGCircleElement(target) ||
IsSVGEllipseElement(target) || IsA<SVGLineElement>(target) || IsSVGEllipseElement(target) || IsA<SVGLineElement>(target) ||
IsA<SVGPolylineElement>(target) || IsA<SVGPolygonElement>(target) || IsA<SVGPolylineElement>(target) || IsA<SVGPolygonElement>(target) ||
IsSVGTextElement(target) || IsSVGClipPathElement(target) || IsA<SVGTextElement>(target) || IsSVGClipPathElement(target) ||
IsSVGMaskElement(target) || IsSVGAElement(target) || IsSVGMaskElement(target) || IsSVGAElement(target) ||
IsSVGForeignObjectElement(target); IsSVGForeignObjectElement(target);
} }
......
...@@ -116,7 +116,7 @@ LayoutObject* SVGTextPathElement::CreateLayoutObject(const ComputedStyle&, ...@@ -116,7 +116,7 @@ LayoutObject* SVGTextPathElement::CreateLayoutObject(const ComputedStyle&,
bool SVGTextPathElement::LayoutObjectIsNeeded( bool SVGTextPathElement::LayoutObjectIsNeeded(
const ComputedStyle& style) const { const ComputedStyle& style) const {
if (parentNode() && if (parentNode() &&
(IsSVGAElement(*parentNode()) || IsSVGTextElement(*parentNode()))) (IsSVGAElement(*parentNode()) || IsA<SVGTextElement>(*parentNode())))
return SVGElement::LayoutObjectIsNeeded(style); return SVGElement::LayoutObjectIsNeeded(style);
return false; return false;
......
...@@ -35,7 +35,7 @@ LayoutObject* SVGTSpanElement::CreateLayoutObject(const ComputedStyle&, ...@@ -35,7 +35,7 @@ LayoutObject* SVGTSpanElement::CreateLayoutObject(const ComputedStyle&,
bool SVGTSpanElement::LayoutObjectIsNeeded(const ComputedStyle& style) const { bool SVGTSpanElement::LayoutObjectIsNeeded(const ComputedStyle& style) const {
if (parentNode() && if (parentNode() &&
(IsSVGAElement(*parentNode()) || IsSVGTextElement(*parentNode()) || (IsSVGAElement(*parentNode()) || IsA<SVGTextElement>(*parentNode()) ||
IsA<SVGTextPathElement>(*parentNode()) || IsA<SVGTextPathElement>(*parentNode()) ||
IsSVGTSpanElement(*parentNode()))) IsSVGTSpanElement(*parentNode())))
return SVGElement::LayoutObjectIsNeeded(style); return SVGElement::LayoutObjectIsNeeded(style);
......
...@@ -500,7 +500,7 @@ static bool IsDirectReference(const SVGElement& element) { ...@@ -500,7 +500,7 @@ static bool IsDirectReference(const SVGElement& element) {
return IsSVGPathElement(element) || IsA<SVGRectElement>(element) || return IsSVGPathElement(element) || IsA<SVGRectElement>(element) ||
IsSVGCircleElement(element) || IsSVGEllipseElement(element) || IsSVGCircleElement(element) || IsSVGEllipseElement(element) ||
IsA<SVGPolygonElement>(element) || IsA<SVGPolylineElement>(element) || IsA<SVGPolygonElement>(element) || IsA<SVGPolylineElement>(element) ||
IsSVGTextElement(element); IsA<SVGTextElement>(element);
} }
Path SVGUseElement::ToClipPath() const { Path SVGUseElement::ToClipPath() const {
......
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